import akka.kernel.Bootable
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import com.typesafe.config.ConfigFactory

class SimpleCalculatorActor extends Actor {
def receive = {
    case msg: String => println("received " + msg + " from " + sender)
              context.system.shutdown()
    case _ => println("Received unknown msg ")
}
}

class CalculatorApplication extends Bootable {
  //#setup
  val system = ActorSystem("CalculatorApplication",
    ConfigFactory.load.getConfig("server"))
  val actor = system.actorOf(Props[SimpleCalculatorActor], "simpleCalculator")
  //#setup

  def startup() {
  }

  def shutdown() {
    system.shutdown()
  }
}

object CalcApp {
  def main(args: Array[String]) {
    new CalculatorApplication
    println("Started Calculator Application - waiting for messages")
  }
}
